package com.auxgroup.hr.front.service.personnal.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

import com.auxgroup.hr.front.dao.domain.PsCPersonalInfoClass;
import com.auxgroup.hr.front.dao.domain.PsCSocialTbl;
import com.auxgroup.hr.front.dao.repository.PsCSocialTblRepository;
import com.auxgroup.hr.front.service.personnal.SocialTblService;

/** 
 * @author wangchangyun
 * @version 创建时间：180523 
 * 社保公积金service
 */
@Service("socialTblService")
public class SocialTblServiceImpl implements SocialTblService {
	private static final Logger logger = LoggerFactory.getLogger(SocialTblServiceImpl.class);
	
	@Autowired
	private PsCSocialTblRepository PsCSocialTblRepository;


	@Override
	public PsCSocialTbl getSocialTbl(PsCPersonalInfoClass personalInfo) {
		return PsCSocialTblRepository.findOne(personalInfo);
	}


	@Override
	public PsCSocialTbl save(PsCSocialTbl SocialTbl) {
		return PsCSocialTblRepository.save(SocialTbl);
	}


	@Override
	public Boolean delete(PsCPersonalInfoClass personalInfo) {
		try {
			PsCSocialTblRepository.delete(personalInfo);
		} catch (Exception e) {
			logger.error("delete SocialTbl error: personalInfo={}",personalInfo,e);
			return false;
		}
		return true;
	}
	
	
	@Override
	public List<PsCSocialTbl> getAll(String emplid) {
		PsCSocialTbl SocialTbl = new PsCSocialTbl();
		SocialTbl.setEmplid(emplid);
		return PsCSocialTblRepository.findAll(Example.of(SocialTbl));
	}


	
	
	
}
